﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SzCourt.Logic.NBL.DBEntities;
using SzCourt.Logic.BLL;

namespace SzCourt.WebSite.shenwu
{
    public partial class zxresult : System.Web.UI.Page
    {
        private string _ID = string.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                getInfo();
            }
        }

        private void getInfo()
        {
            this._ID = string.IsNullOrEmpty(Request.QueryString["id"]) ? "" : Request.QueryString["id"];
            this.hdnID.Value = this._ID;

            pCaseCarryOutInfo param = new pCaseCarryOutInfo();
            if (this._ID.Length > 0)
            {
                param.CCOIID = Convert.ToInt32(this._ID);
            }
            else
            {
                Response.Redirect("/shenwu/zxgk.aspx");
            }
            

            CarryOut bll = new CarryOut();
            CaseCarryInfo result = (CaseCarryInfo)bll.GetCarryOutInfo(param);

            if (result != null)
            {
                this.tdCaseName.InnerHtml = result.CaseName+"&nbsp;";
                this.tdCourtClerk.InnerHtml = result.CourtClerk + "&nbsp;";
                this.tdJudge.InnerHtml = result.Judge + "&nbsp;";

                //if (result.detailList.Count > 0)
                //{
                //    this.rptDataList.DataSource = result.detailList;
                //    this.rptDataList.DataBind();
                //}
            }

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            pCaseCarryOutInfo param = new pCaseCarryOutInfo();

            this._ID = this.hdnID.Value;
            if (this._ID.Length > 0)
            {
                param.CCOIID = Convert.ToInt32(this._ID);
            }
            else
            {
                Response.Redirect("/shenwu/zxgk.aspx");
            }
            param.QueryPWD = this.txtPassword.Value;

            CarryOut bll = new CarryOut();
            CaseCarryInfo result = (CaseCarryInfo)bll.GetCarryOutInfo(param);

            if (result != null)
            {
                this.tdCaseName.InnerHtml = result.CaseName;
                this.tdCourtClerk.InnerHtml = result.CourtClerk;
                this.tdJudge.InnerHtml = result.Judge;

                if (result.QueryPWD == this.txtPassword.Value)
                {
                    if (result.detailList != null && result.detailList.Count > 0)//显示执行进度
                    {
                        this.tag12.Visible = true;
                        this.rptDataList.DataSource = result.detailList;
                        this.rptDataList.DataBind();
                    }

                    if (result.docList != null && result.docList.Count > 0)
                    {
                        this.tag1122.Visible = true;
                        this.rptDocList.DataSource = result.docList;
                        this.rptDocList.DataBind();
                    }
                    this.tblPasswordLogin.Visible = false;
                }
               
            }
        }
    }
}